package com.firefly.admin.common.config;

import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

@Component
public class MinioClientConfig {

    @Value("${minio.minioUrl}")
    private String minioUrl;

    @Value("${minio.userName}")
    private String userName;

    @Value("${minio.password}")
    private String password;

    /**
     * 注入minio 客户端
     *
     * @return
     */
    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder()
                .endpoint(minioUrl)
                .credentials(userName, password)
                .build();
    }
}
